﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using Manager.App_Code;
using Manager.Common;
using Manager.App_Code.IDAL;
using Manager.App_Code.DAL;
using Manager.App_Code.DTO;

namespace Manager.FormAdd_Edit
{
    public partial class Frm_ListRoom : DevExpress.XtraEditors.XtraForm
    {
        NewPearl_HotelDataContext db = new NewPearl_HotelDataContext();
        public Phong phong = null;
        List<string> lstMaPhong = null;

        public Frm_ListRoom(List<string> _lstMaPhong)
        {
            InitializeComponent();
            lstMaPhong = _lstMaPhong;
        }

        public Frm_ListRoom()
        {
            InitializeComponent();
        }

        private void Frm_ListRoom_Load(object sender, EventArgs e)
        {
            if (lstMaPhong != null)
                gridControl1.DataSource = db.Phongs.Where(i => i.TinhTrang == "1" && !lstMaPhong.Contains(i.MaPhong)).ToList();
            else
                gridControl1.DataSource = db.Phongs.Where(i => i.TinhTrang == "1").ToList();
        }  

        private void gridControl1_DoubleClick(object sender, EventArgs e)
        {
            int index = gridView1.FocusedRowHandle;
            phong = gridView1.GetRow(index) as Phong;
            this.Close();
        }
    }
}